import request from '@/utils/request'
import requeste from '@/utils/requestexcel'
export default{
  //1讲师列表  （条件查询分页）
  getTeacherListPage(current,limit,teacherQuery){
    return request({
      // url: '/eduservice/edu-teacher/pageTeacherConditon/'+current+'/'+limit,
      url: `/eduservice/edu-teacher/pageTeacherConditon/${current}/${limit}`,
      method: 'post',
      //teacherQuery条件对象，后端使用RequestBody获取数据
      //data表示把对象转换程json进行传递到接口里面去
      data: teacherQuery
    })
  },
  //2根据id删除讲师
  deleteTeacherByid(id){
    return request({
      // url: '/eduservice/edu-teacher/pageTeacherConditon/'+current+'/'+limit,
      url: `/eduservice/edu-teacher/${id}`,
      method: 'delete',
      //teacherQuery条件对象，后端使用RequestBody获取数据
      //data表示把对象转换程json进行传递到接口里面去
    })
  },
  //添加讲师
  addTeacher(teacher){
    return request({
      // url: '/eduservice/edu-teacher/pageTeacherConditon/'+current+'/'+limit,
      url: `/eduservice/edu-teacher/addTeacher`,
      method: 'post',
      //teacherQuery条件对象，后端使用RequestBody获取数据
      //data表示把对象转换程json进行传递到接口里面去
      data: teacher
    })
  },
  getTeacherInfo(id){
    return request({
      url: `/eduservice/edu-teacher/getTeacher/${id}`,
      method: 'get'
    })
  },
  //修改讲师
  updateTeacherinfo(teacher){
    return request({
      url: `/eduservice/edu-teacher/updateTeacher`,
      method: 'post',
      data: teacher
    })
  },
  //上传讲师头像
  uploadavtar(file){
    return request({
      url: `/eduoss/fileoss`,
      method: 'post',
      data: file
    })
  },
  exportteacherexcel(){
    return requeste({
      url: `/eduservice/edu-teacher/teacherexcel`,
      method: 'post',
      data: {},
      responseType: 'blob' // 表明返回服务器返回的数据类型
    })

  }

}
